package com.base.monitor.module.biz.util;

import cn.hutool.core.util.StrUtil;

public class AsciiUtils {

    /**
     * 根据字符串获取对应的ascii码
     * @param str
     * @return
     */
    public static String getAsciiFromStr(String str) {
        if (StrUtil.isBlank(str) || str.length() != 2) {
            return "";
        }
        switch (str) {
            case "29":
                return "-";
            case "30":
                return "0";
            case "31":
                return "1";
            case "32":
                return "2";
            case "33":
                return "3";
            case "34":
                return "4";
            case "35":
                return "5";
            case "36":
                return "6";
            case "37":
                return "7";
            case "38":
                return "8";
            case "39":
                return "9";
            default:
                return "";
        }
    }
}
